{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "123\n"
     ]
    }
   ],
   "source": [
    "准备工作"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "vscode 需要安装的插件 gitlens ,juyper, codeRunner\n",
    "\n",
    "安装 jupyter \n",
    "\n",
    "<img src =\"image/Snipaste_2023-12-18_23-02-18.png\">\n",
    "   \n",
    "vscode 点击 设置 输入 code Runner\n",
    "\n",
    "   <img src=\"image/Snipaste_2023-12-18_22-54-20.png\">\n",
    "\n",
    "cmd 找位置\n",
    "\n",
    "   <img src=\"image/Snipaste_2023-12-18_22-55-56.png\">\n",
    "codeRunner 配置 \n",
    "\n",
    "   <img src=\"image/Snipaste_2023-12-18_22-55-19.png\">\n",
    "   \"python\": \"C:/Users/Administrator/AppData/Local/Programs/Python/Python311/python.exe\",\n",
    "\n",
    "\n",
    "  "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 字符串的创建,\n",
    "  '' \n",
    "  \"\" \n",
    "  ''''''\n",
    "  \"\"\"\"\"\"\n",
    "\n",
    "\n",
    "\n",
    "# 字符串的拼接，字符串的访问,字符串的删除。字符串的格式化，字符串的函数的使用"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "我是一个苹果手机 我是一个苹果手机 <class 'str'> <class 'str'>\n",
      "KMS激活安装/卸载自动续期功能: 两种模式可供选择 [1]自动续订模式(默认) [2]任务计划模式清除KMS客户端信息：清除KMS服务器地址、端口、激活时间间隔、续订时间间隔等搭建KMS服务器[手动激活]：KMS服务器地址/端口\n"
     ]
    }
   ],
   "source": [
    "Apples = '我是一个苹果手机'\n",
    "Apple = \"我是一个苹果手机\"\n",
    "\n",
    "print(Apples,Apple,type(Apples),type(Apple))\n",
    "\n",
    "windows_pro = \"KMS激活安装/卸载自动续期功能: 两种模式可供选择 [1]自动续订模式(默认) [2]任务计划模式清除KMS客户端信息：清除KMS服务器地址、端口、激活时间间隔、续订时间间隔等搭建KMS服务器[手动激活]：KMS服务器地址/端口\"\n",
    "\n",
    "\n",
    "print(windows_pro)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "KMS激活安装/卸载自动续期功能: 两种模式可供选择 [1]自动续订模式(默认) [2]任务计划模式清除KMS客户端信息：清除KMS服务器地址、端口、激活时间间隔、续订时间间隔等搭建KMS服务器[手动激活]：KMS服务器地址/端口\n",
      " KMS激活\n",
      "安装/卸载自动续期功能: 两种模式可供选择 [1]自动续订模式(默认) [2]任务计划模式\n",
      "清除KMS客户端信息：清除KMS服务器地址、端口、激活时间间隔、续订时间间隔等\n",
      "搭建KMS服务器[手动激活]：KMS服务器地址/端口\n",
      "数字激活\n",
      "添加/解除KMS38保护: 免受180天激活影响，除非解除保护，否则不能使用KMS38激活\n",
      "系统信息：网络状态/激活状态，描述便于快速查看是否支持数字许可证/KMS38\n",
      "OEM激活\n",
      "卸载OEM激活信息：清除动态加载的SLIC等信息，OEM激活将失效\n",
      "生产$OEM$文件夹：可将该文件夹置于ISO镜像source文件夹下，以集成OEM激活功能\n",
      "系统信息：查看系统是否支持OEM激活\n",
      "其他功能\n",
      "更改Windows 10版本、激活信息备份还原、Microsoft Office 零售版转换批量授权版\n",
      "Windows/Office密钥管理功能：安装密钥、卸载密钥、查看密钥、清除Office许可证\n",
      "智能激活、激活成功率高、支持静默参数、几乎支持所有 Windows/Office 所有版本\n",
      "Windows 7上无需依赖.NET Framework、能\n"
     ]
    }
   ],
   "source": [
    "windows_pross  = '''KMS激活\n",
    "安装/卸载自动续期功能: 两种模式可供选择 [1]自动续订模式(默认) [2]任务计划模式\n",
    "清除KMS客户端信息：清除KMS服务器地址、端口、激活时间间隔、续订时间间隔等\n",
    "搭建KMS服务器[手动激活]：KMS服务器地址/端口\n",
    "数字激活\n",
    "添加/解除KMS38保护: 免受180天激活影响，除非解除保护，否则不能使用KMS38激活\n",
    "系统信息：网络状态/激活状态，描述便于快速查看是否支持数字许可证/KMS38\n",
    "OEM激活\n",
    "卸载OEM激活信息：清除动态加载的SLIC等信息，OEM激活将失效\n",
    "生产$OEM$文件夹：可将该文件夹置于ISO镜像source文件夹下，以集成OEM激活功能\n",
    "系统信息：查看系统是否支持OEM激活\n",
    "其他功能\n",
    "更改Windows 10版本、激活信息备份还原、Microsoft Office 零售版转换批量授权版\n",
    "Windows/Office密钥管理功能：安装密钥、卸载密钥、查看密钥、清除Office许可证\n",
    "智能激活、激活成功率高、支持静默参数、几乎支持所有 Windows/Office 所有版本\n",
    "Windows 7上无需依赖.NET Framework、能'''\n",
    "\n",
    "print(windows_pro)\n",
    "\n",
    "windows_prosss =\"\"\" KMS激活\n",
    "安装/卸载自动续期功能: 两种模式可供选择 [1]自动续订模式(默认) [2]任务计划模式\n",
    "清除KMS客户端信息：清除KMS服务器地址、端口、激活时间间隔、续订时间间隔等\n",
    "搭建KMS服务器[手动激活]：KMS服务器地址/端口\\\n",
    "数字激活\n",
    "添加/解除KMS38保护: 免受180天激活影响，除非解除保护，否则不能使用KMS38激活\n",
    "系统信息：网络状态/激活状态，描述便于快速查看是否支持数字许可证/KMS38\n",
    "OEM激活\n",
    "卸载OEM激活信息：清除动态加载的SLIC等信息，OEM激活将失效\n",
    "生产$OEM$文件夹：可将该文件夹置于ISO镜像source文件夹下，以集成OEM激活功能\n",
    "系统信息：查看系统是否支持OEM激活\n",
    "其他功能\n",
    "更改Windows 10版本、激活信息备份还原、Microsoft Office 零售版转换批量授权版\n",
    "Windows/Office密钥管理功能：安装密钥、卸载密钥、查看密钥、清除Office许可证\n",
    "智能激活、激活成功率高、支持静默参数、几乎支持所有 Windows/Office 所有版本\n",
    "Windows 7上无需依赖.NET Framework、能\"\"\"\n",
    "\n",
    "print(windows_prosss)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "字符串的访问\n",
    "序列或队列\n",
    "0开始访问的 0的位置就代表A \n",
    "\n",
    "访问一下B or C or D "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "A B\n",
      "访问区间之间的数据 BCDEFG\n",
      "ABCDEFGH ABCDEFGH\n",
      "ABCDEFG\n"
     ]
    }
   ],
   "source": [
    "test_code = 'ABCDEFGHIG'\n",
    "test_code = \"ABCDEFGHIG\"\n",
    "#  访问单个元素\n",
    "name_a  = test_code[0]\n",
    "name_b =test_code[1]\n",
    "\n",
    "print(name_a,name_b)\n",
    "\n",
    "# 访问区间之间的元素\n",
    "# 含首不含尾，\n",
    "qujian_name  =test_code [1:7]\n",
    "print(\"访问区间之间的数据\",qujian_name)\n",
    "\n",
    "# 访问A-I 之间的数据\n",
    "a_name = test_code[0:8]\n",
    "b_name = test_code[:8]\n",
    "print(a_name,b_name)\n",
    "# 从尾部来访问数据\n",
    "end_name = test_code [:-3]\n",
    "print(end_name)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 字符串的拼接 \n",
    "+"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "20ms li 我的学校是二小\n",
      "我最后拼接的数据是:  我的名字是Alice ,我的年龄是 30岁\n",
      "我使用了两种类型字符串和数字 我的姓名是 ms li ,我的年龄是30\n",
      "Hello,ms li ,我的年龄是30\n",
      "我的姓名是 ms li ,我的年龄是30,我的地址北京市房山区\n"
     ]
    }
   ],
   "source": [
    "age = '20'\n",
    "name =\"ms li \"\n",
    "school = \"我的学校是二小\"\n",
    "\n",
    "final_name = age+name+school\n",
    "print(final_name)\n",
    "names =\"Alice\"\n",
    "age = 30 \n",
    "greeting = \"我的名字是,年龄是多少岁\"\n",
    "# %s %d  python2.7 的语法\n",
    "final_age = \"我的名字是%s ,我的年龄是 %s岁\"  %(names,age)\n",
    "print(\"我最后拼接的数据是: \",final_age)\n",
    "#arguments\n",
    "#final_ages = \"我的名字是%s ,我的年龄是 %s岁\"  %(names)\n",
    "\n",
    "ages =30 \n",
    "final_ages =\"我的姓名是 %s,我的年龄是%d\" % (name,ages)\n",
    "\n",
    "print(\"我使用了两种类型字符串和数字\",final_ages)\n",
    "\n",
    "\n",
    "#3.6 支持的语法\n",
    "final_python3_age = f\"Hello,{name},我的年龄是{age}\"\n",
    "# %\n",
    "address = \"北京市房山区\"\n",
    "greetings = \"我的姓名是 {},我的年龄是{},我的地址{}\".format(name,age,address)\n",
    "print(final_python3_age)\n",
    "print(greetings)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#字符串的函数\n",
    "# replace   查找替换\n",
    "# endswitch 是否以什么结尾\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "hello world\n",
      "查找替换字符串的函数 hello china\n",
      "False\n",
      "3\n",
      "-1\n"
     ]
    }
   ],
   "source": [
    "world  =\"hello world\"\n",
    "print(world)\n",
    "# replace  \n",
    "\n",
    "new_word = world.replace('world','china')\n",
    "print(\"查找替换字符串的函数\",new_word)\n",
    "\n",
    "# 目录下  txt ,excel. csv 文件 csv 格式的文件或excle 文件的格式 \n",
    "test_file =\"1.txt\"\n",
    "print(test_file.endswith('csv'))\n",
    "\n",
    "print(test_file.find('x'))\n",
    "print(test_file.find('z'))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# for 循环  章节去讲\n",
    "# true false   真假类型  存在即为真,不存在为佳\n",
    "\n",
    "# 列表类型  \n",
    "# 创建列表\n",
    "\n",
    "# 字符串join \n",
    "讲字符串以什么样的方式进行拼接\n",
    "list() 转换为列表"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "我是一个苹果手机\n",
      "<class 'str'>\n",
      "['我', '是', '一', '个', '苹', '果', '手', '机']\n",
      "[] [] <class 'list'> <class 'list'>\n",
      "['我', '是', '一', '个', '苹', '果', '手', '机']\n",
      "一\n",
      "['一', '个']\n",
      "['我', '是', '一', '个', '苹', '果']\n",
      "一 ['一', '个'] ['我', '是', '一', '个', '苹', '果']\n"
     ]
    }
   ],
   "source": [
    "Apples = '我是一个苹果手机'\n",
    "\n",
    "\n",
    "\n",
    "# \n",
    "big_apples = \"\".join(Apples)\n",
    "print(big_apples)\n",
    "print(type(big_apples))\n",
    "\n",
    "print(list(big_apples))\n",
    "\n",
    "test_list = [] \n",
    "test_list2 = list() \n",
    "\n",
    "print(test_list,test_list2,type(test_list),type(test_list2))\n",
    "\n",
    "# \n",
    "final_apple = list(big_apples)\n",
    "print(final_apple)\n",
    "\n",
    "# 访问元素 2\n",
    "print(final_apple[2])\n",
    "print(final_apple[2:4])\n",
    "print(final_apple[:-2])\n",
    "\n",
    "\n",
    "new_apple = final_apple[2]\n",
    "new_apple2 = final_apple[2:4]\n",
    "new_apple3 = final_apple[:-2]\n",
    "\n",
    "print(new_apple,new_apple2,new_apple3)\n",
    "\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# for 循环在讲\n",
    "# push \n",
    "  \n",
    "# pop "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['我', '是', '一', '个', '苹', '果', '手', '机']\n",
      "['我', '是', '一', '个', '苹', '果', '手', '机', 'apple_computer', 'apple_watch ', 'apple_tv']\n",
      "['apple_computer', 'apple_watch ', 'Mac Pro']\n",
      "['apple_computer', 'apple_watch ']\n"
     ]
    }
   ],
   "source": [
    "print(final_apple)\n",
    "\n",
    "\n",
    "apple_quanjiatong = ['apple_computer','apple_watch ','apple_tv']\n",
    "# 拼接元素\n",
    "apple_2 = final_apple + apple_quanjiatong\n",
    "print(apple_2)\n",
    "\n",
    "#apple_3 = final_apple.push(apple_quanjiatong)\n",
    "#print(\"我是否是全家桶\",apple3)\n",
    "\n",
    "#apple_quanjiatong = ['apple_computer','apple_watch ','apple_tv']\n",
    "# 修改元素\n",
    "apple_quanjiatong[2] = 'Mac Pro'\n",
    "\n",
    "print(apple_quanjiatong)\n",
    "# 删除元素\n",
    "del apple_quanjiatong[2]\n",
    "\n",
    "print(apple_quanjiatong)\n",
    "\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
